package com.vne.skyemart.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.vne.skyemart.dao.ContactDao;
import com.vne.skyemart.model.Contact;
import com.vne.skyemart.service.ContactService;

@Service("contactService")
@Transactional(propagation = Propagation.SUPPORTS,readOnly = true)
public class ContactServiceImpl implements ContactService{
	@Autowired
	private ContactDao contactDao;

	public ContactDao getContactDao() {
		return contactDao;
	}

	public void setContactDao(ContactDao contactDao) {
		this.contactDao = contactDao;
	}
	public ContactServiceImpl() {}
	@Transactional(propagation = Propagation.SUPPORTS,readOnly = false)
	@Override
	public void addContact(Contact contact) {
		contactDao.save(contact);
	}

	@Override
	public List<Contact> listContact() {
		return contactDao.findAll();
	}
	
}
